// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.16.10
package sys

import (
	"context"
	"hotgo/api/admin/activityuser"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	ActivityUser = cActivityUser{}
)

type cActivityUser struct{}

// List 查看活动用户管理列表
func (c *cActivityUser) List(ctx context.Context, req *activityuser.ListReq) (res *activityuser.ListRes, err error) {
	list, totalCount, err := service.SysActivityUser().List(ctx, &req.ActivityUserListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.ActivityUserListModel{}
	}

	res = new(activityuser.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出活动用户管理列表
func (c *cActivityUser) Export(ctx context.Context, req *activityuser.ExportReq) (res *activityuser.ExportRes, err error) {
	err = service.SysActivityUser().Export(ctx, &req.ActivityUserListInp)
	return
}

// Edit 更新活动用户管理
func (c *cActivityUser) Edit(ctx context.Context, req *activityuser.EditReq) (res *activityuser.EditRes, err error) {
	err = service.SysActivityUser().Edit(ctx, &req.ActivityUserEditInp)
	return
}

// View 获取指定活动用户管理信息
func (c *cActivityUser) View(ctx context.Context, req *activityuser.ViewReq) (res *activityuser.ViewRes, err error) {
	data, err := service.SysActivityUser().View(ctx, &req.ActivityUserViewInp)
	if err != nil {
		return
	}

	res = new(activityuser.ViewRes)
	res.ActivityUserViewModel = data
	return
}

// Delete 删除活动用户管理
func (c *cActivityUser) Delete(ctx context.Context, req *activityuser.DeleteReq) (res *activityuser.DeleteRes, err error) {
	err = service.SysActivityUser().Delete(ctx, &req.ActivityUserDeleteInp)
	return
}

// Status 更新活动用户管理状态
func (c *cActivityUser) Status(ctx context.Context, req *activityuser.StatusReq) (res *activityuser.StatusRes, err error) {
	err = service.SysActivityUser().Status(ctx, &req.ActivityUserStatusInp)
	return
}

// Import 批量导入活动用户
func (c *cActivityUser) Import(ctx context.Context, req *activityuser.ImportExcelReq) (res *activityuser.ImportExcelRes, err error) {
	res, err = service.SysActivityUser().ImportExcel(ctx, &req.ActivityUserImportExcelIn)
	return
}
